#ifndef MINIMAL_INTERFACE_HPP
#define MINIMAL_INTERFACE_HPP

#include <deque>

#include "GlobalDefines.hpp"
// Interface specific includes
#include "Widget.hpp"
#include "Win.hpp"
#include "Button.hpp"
#include "View.hpp"
#include "Textbox.hpp"
#include "CycleButton.hpp"

namespace mi
{
    class Interface
    {
    public:
        static Interface& I();

        bool AddWidget(Widget* additionalWidget);

        bool MouseClick(sf::Mouse::Button button, sf::MouseState state, int x, int y);

        bool MouseMoved(int x, int y, int dx, int dy);

        bool MouseDragged(int x, int y, int dx, int dy);

        bool MouseWheel(int dir);

        bool KeysDown(sf::Event::KeyEvent key);

        bool KeysUp(sf::Event::KeyEvent key);

        bool TextEntered(char ch);

        void OnResize(int w, int h);

        void Draw2D();

        bool Update(double dTime);

    private:
        // Functions

        Interface();

        Interface(Interface& other);

        void operator = (Interface& other);

        bool MoveToTopOfWidgets(Widget* ptr);

        Widget* FindTopLevelOwner(Widget* ofThisWidget);

        // Variables

        Widget *activeWidget;

        Widget *mouseOverWidget;

        std::deque<Widget*> widgets;

        static Interface *instance;
    };
}

#endif